//
//  SetupViewController.m
//  OfferJob
//
//  Created by 河南动力无限科技有限公司 on 17/7/20.
//  Copyright © 2017年 郑州动力无限科技. All rights reserved.
//

#import "SetupViewController.h"
#import "SetupableViewCell.h"
#import "xiuMiViewController.h"
#import "gaiZhiFViewController.h"
#import "zhiFuViewController.h"
@interface SetupViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong)UITableView* tableView;
@end

@implementation SetupViewController

- (void)viewDidLoad {
    self.title=@"设置";
    [super viewDidLoad];
       _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT-49)];
    _tableView.delegate=self;
    _tableView.dataSource=self;
    _tableView.backgroundColor=backgroundcolor;
    [_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    [_tableView registerClass:[SetupableViewCell class] forCellReuseIdentifier:@"SetupableViewCell"];
    [self.view addSubview:_tableView];
 
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSArray* iconArr=@[@"icon_suoo",@"icon_suooo",@"icon_xiug",@"icon_tuic"];
      NSArray* titleArr=@[@"设置支付密码",@"修改支付密码",@"修改登录密码",@"退出登录"];
    SetupableViewCell *cell = (SetupableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"SetupableViewCell" forIndexPath:indexPath];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
      cell.backgroundColor=[UIColor whiteColor];
    cell.imagView.image=[UIImage imageNamed:iconArr[indexPath.row]];
    cell.titleLB.text=titleArr[indexPath.row];
  
       return cell;
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row==0) {
        zhiFuViewController* xiumima=[[zhiFuViewController alloc]init];
        [self .navigationController pushViewController:xiumima animated:YES];
        
    }else if (indexPath.row==1){
        gaiZhiFViewController* xiumima=[[gaiZhiFViewController alloc]init];
        [self .navigationController pushViewController:xiumima animated:YES];
     
    }else if (indexPath.row==2) {
        xiuMiViewController* xiumima=[[xiuMiViewController alloc]init];
        [self .navigationController pushViewController:xiumima animated:YES];
        
    }else if (indexPath.row==3){
   UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"退出登录" message:@"您确定退出登录" preferredStyle:UIAlertControllerStyleAlert];
        
        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
        UIAlertAction *usePhoto = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            NSLog(@"确定的内容");
            
                }];
            [alertController addAction:usePhoto];
            [alertController addAction:cancelAction];
            [self presentViewController:alertController animated:YES completion:nil];
    }
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44*kAppScale;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
